on_selected_cpus() must not send IPIs with empty target masks.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 23 Mar 2006 17:47:43 +0000 (18:47 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 23 Mar 2006 17:47:43 +0000 (18:47 +0100)
This causes send accept errors on Pentium/P6 .

Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/smp.c

index 690bf3121ff262d450bb9f89c588cc8381fae86a..fc0a545883e71939e466a04b029f457a022fbcaa 100644 (file)
@@ -106,6 +106,16 @@ void send_IPI_self(int vector)
     __send_IPI_shortcut(APIC_DEST_SELF, vector);
 }
 
+static inline void check_IPI_mask(cpumask_t cpumask)
+{
+    /*
+     * Sanity, and necessary. An IPI with no target generates a send accept
+     * error with Pentium and P6 APICs.
+     */
+    ASSERT(cpus_subset(cpumask, cpu_online_map));
+    ASSERT(!cpus_empty(cpumask));
+}
+
 /*
  * This is only used on smaller machines.
  */
@@ -115,6 +125,8 @@ void send_IPI_mask_bitmask(cpumask_t cpumask, int vector)
     unsigned long cfg;
     unsigned long flags;
 
+    check_IPI_mask(cpumask);
+
     local_irq_save(flags);
 
     /*
@@ -146,6 +158,8 @@ inline void send_IPI_mask_sequence(cpumask_t mask, int vector)
     unsigned long cfg, flags;
     unsigned int query_cpu;
 
+    check_IPI_mask(mask);
+
     /*
      * Hack. The clustered APIC addressing mode doesn't allow us to send 
      * to an arbitrary mask, so I do a unicasts to each CPU instead. This 
@@ -304,6 +318,9 @@ extern int on_selected_cpus(
 
     ASSERT(local_irq_is_enabled());
 
+    if ( nr_cpus == 0 )
+        return 0;
+
     data.func = func;
     data.info = info;
     data.wait = wait;